package com.eastfair.certificate.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 证件审核表
 * </p>
 *
 * @author ligang
 * @date 2023-05-08
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "CertificateAuthAuthSystemEnum", description = "审核方:#{COURT:主场系统;CERTIFICATE:制证系统;PCOMPOSITEVENUE:综合系统-枚举")
public enum CertificateAuthAuthSystemEnum implements BaseEnum {

    /**
     * COURT="主场系统"
     */
    COURT("主场系统"),
    /**
     * CERTIFICATE="制证系统"
     */
    CERTIFICATE("制证系统"),
    /**
     * PCOMPOSITEVENUE="综合系统"
     */
    PCOMPOSITEVENUE("综合系统"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static CertificateAuthAuthSystemEnum match(String val, CertificateAuthAuthSystemEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static CertificateAuthAuthSystemEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(CertificateAuthAuthSystemEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "COURT,CERTIFICATE,PCOMPOSITEVENUE", example = "COURT")
    public String getCode() {
        return this.name();
    }

}
